package com.baosight.sczx.zm.cl.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.cl.RoundCheckWorkNote;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.common.zm.cInterface.cs.WorkSchedule;
import com.baosight.sczx.zm.cl.domain.ZMCLRiskRecord;

/**
 * 隐患整改反馈模块
 * 隐患责任 部门操作
 * 已整改隐患
 * <p>Title: ServiceZMCL74.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 严洪浩
 * @version 1.0
 * <pre>Histroy:
 *          2011-8-6 上午11:13:34  严洪浩  Create
 *</pre>
 */
public class ServiceZMCL74 extends ServiceEPBase {

	/**
	 * 初始进入
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCL70</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-5上午07:50:22 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo  = this.query(inInfo);
		
		outInfo.addBlock(Department.getInstance().getConstructionUnit("cmes.cl.orgName", "orgCode", "orgName", true));//组织机构
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskSource", true));//隐患来源
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskLevel", true));//隐患级别
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskClassify", true));//隐患分类
		outInfo.addBlock(WorkSchedule.getWorkScheduleBlock("cmes.cl.riskWorknum", false));//隐患班次
		//outInfo.addBlock(WorkingFace.getAllWorkingFace("cmes.cl.workface", true));//所在工作面
		//outInfo.addBlock(RoadWay.getAllRoadWay("cmes.cl.path", true));//所在巷道
		outInfo.addBlock(RoundCheckWorkNote.getAllNoteCode("cmes.cl.workNote", true));//巡检工单
		
		return outInfo;
	}
	
	/**
	 * 查询
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCL70</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-8-5上午07:51:16 严洪浩
	 * </p>
	 *
	 */
	@Override
	public EiInfo query(EiInfo inInfo) {
		if(inInfo.getBlock(EiConstant.queryBlock) == null){
			StaticTools.setQueryParameters(inInfo, "fdEndDate", StaticTools.getDate(), true);//截止日期
		}
		StaticTools.setQueryParameters(inInfo, "fdDepartmentId", UserSession.getInSessionProperty("orgCode"), true);//隐患部门
		StaticTools.setQueryParameters(inInfo, "isModifyed", "yes", true);//所有已整改隐患
		EiInfo outInfo = super.query(inInfo, "ZMCLRiskRecord.query", new ZMCLRiskRecord());
		
		return outInfo;
	}
	
}
